package com.gxgeek.javabasic.collection.map;

import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;

/**
 * Created by GX on 2017/8/29.
 */

public class AnalyzeLinkdHashMap {

    public static void main(String[] args) {
        noArgsConstructor();
//        haveArgsConstructor();

    }

    private static void noArgsConstructor() {
        Map map = new LinkedHashMap();
        map.put("1","gxgeek");
        map.put("2","cancer");
        map.put("3","reverse");
        map.put("4","hash");
        map.put("5","demo");
        Iterator iterator = map.entrySet().iterator();
        while (iterator.hasNext()){
            Map.Entry entry = (Map.Entry) iterator.next();
            System.out.println(entry);
        }
    }
    private static void haveArgsConstructor() {
        Map map = new LinkedHashMap(16,0.75f,true);
        map.put("1","gxgeek");
        map.put("2","cancer");
        map.put("3","reverse");
        map.put("4","hash");
        map.put("5","demo");
        map.get("1");
        map.get("2");
        Iterator iterator = map.entrySet().iterator();
        while (iterator.hasNext()){
            Map.Entry entry = (Map.Entry) iterator.next();
            System.out.println(entry);
        }
    }
}
